package com.tanhua.dubbo.server.api;

import com.alibaba.dubbo.config.annotation.Service;
import com.tanhua.dubbo.server.pojo.Option;
import com.tanhua.dubbo.server.pojo.Question;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

import java.util.List;

@Service(version = "1.0.0")
public class QuestionApiImpl implements QuestionApi {

    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public List<Question> queryQuestionListByIds(List<String> ids) {
        Query query = Query.query(Criteria.where("id").in(ids));

        return mongoTemplate.find(query, Question.class);
    }
}
